import numpy as np
import tensorflow as tf

# 生成模拟数据（50个特征）
X = np.random.rand(1000, 10, 5)  # 1000样本，每个样本10x5
y = np.random.randint(0, 2, 1000)  # 二分类标签

model = tf.keras.Sequential([
    tf.keras.layers.LSTM(64, input_shape=(10, 5)),
    tf.keras.layers.Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
model.fit(X, y, epochs=10)
model.save('iot_model.h5')
print("✅ 模型已保存为 iot_model.h5")